package com.lin.collector.web;

import com.lin.collector.util.InputMDC;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.protocol.types.Field;
import org.slf4j.MDC;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 九分石人
 */
@Slf4j
@RestController
public class IndexController {

    /**
     * index
     *
     * @return String
     */
    @RequestMapping(value = "/index")
    public String index() {
        //MDC
        InputMDC.put();
        log.info("info");
        log.warn("warn");
        log.error("error");
        return "idx";
    }

    @RequestMapping(value = "/err")
    public String err() {
        InputMDC.put();
        try {
            int a = 5 / 0;
        } catch (Exception e) {
            log.error(e.getMessage());
            log.error("算术异常:{}", e);
        }
        return "err";
    }

}
